<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="t_bank" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 增加银行账户 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="账户类型" prop="account_type">
              <el-radio-group v-model="t_bank.bank_type">
                <el-radio-button label="组织账户">组织账户</el-radio-button>
                <el-radio-button label="个人账户">个人账户</el-radio-button>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="开户银行" prop="bank_name">
              <el-input v-model="t_bank.bank_tname" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="开户名称" prop="account_name">
              <el-input v-model="t_bank.bank_name" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="银行账户" prop="bank_account">
              <el-input v-model="t_bank.bank_account" />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="increaseBankSupplySubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'IncreaseBankSupply',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        t_bank: {
          bank_type: null,
          bank_tname: null,
          bank_name: null,
          bank_account: null,
        },
        loading: false,
        rules: {
          bank_name: [{
            required: true,
            message: "开户银行不能为空",
            trigger: 'blur',
          }],
          account_name: [{
            required: true,
            message: "开户名称不能为空",
            trigger: 'blur',
          }],
          bank_account: [{
            required: true,
            message: "银行账户不能为空",
            trigger: 'blur',
          }],
        }
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/supplychainmana/ProcureSupplyAction/increaseBankSupply?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      increaseBankSupplySubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/psi/supplychainmana/ProcureSupplyAction/increaseBankSupplySubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/psi/supplychainmana/SelectionPaymentSupply/selectionPaymentSupply?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
    },
  }
</script>
